package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @ClassName ShoppingCartMapper
 * @Description 购物车持久层映射接口
 * @Author sld
 * @Date 2024/7/12 10:01
 * Version 1.0
 **/
@Mapper
public interface ShoppingCartMapper {
    // 根据条件查询购物车数据
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    // 更新购物车数量
    @Update("update shopping_cart set number = #{number} where id = #{id}")
    void updateNumberById(ShoppingCart cart);

    // 新增购物车商品
    void insert(ShoppingCart shoppingCart);

    //删除购物车商品
    void delete(ShoppingCart shoppingCart);

    /**
     * 批量插入购物车数据
     *
     * @param shoppingCartList
     */
    void insertBatch(List<ShoppingCart> shoppingCartList);
}
